<template>
    <div class="link_list_box">
        <div class="item_box" v-for="(item,index) in props.pageData" :key="index" @click="chooseLink(item,index)">
            <div class="font_box">
                <div class="title">
                    <span>{{item.title}}</span>
                    <img v-if="item.type == 7" class="icon_img" src="/static/material/link.png" alt="" />
                </div>
                <div class="link_desc"> {{item.desc}}</div>
            </div>
            <el-image :src="item.cover_image_url" fit="cover" class="image" :class="{icon_radar:item.is_radar==1}"></el-image>
            <div class="choose_box">
                <img v-if="index == chooseLinkIndex" src="@/assets/image/friendcirclemat/image_choose.png" alt="">
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive } from "@vue/reactivity";
const emit = defineEmits(["getData"]);
const props = defineProps(['pageData','chooseData']);

const chooseLinkIndex = ref(null);
const chooseLink = (item,index)=>{
    item.is_local = 0;
    chooseLinkIndex.value = index;
    emit('getData',{
        type:'link',
        data:[item]
    })
}
</script>

<style lang="scss" scoped>
.link_list_box{
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .item_box{
        cursor: pointer;
        position: relative;
        box-sizing: border-box;
        width: 290px;
        border-radius: 1px;
        border: 1px solid #EAEAEA;
        background: #F9F9F9;
        padding:5px 6px 5px 28px;
        margin-bottom: 14px;
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        .choose_box{
            position: absolute;
            width: 16px;
            height: 16px;
            top: 10px;
            left: 6px;
            background: white;
            border: 1px solid #EAEAEA;
            img{
                width: 100%;
                height: 100%;
            }
        }
        .font_box{
            box-sizing: border-box;
            background: #F9F9F9;
            width:180px;
            margin-right: 6px;
            .title{
                display: flex;
                align-items: center;
                width: 180px;
                font-size: 14px;
                font-family: STHeitiSC-Medium, STHeitiSC;
                font-weight: 800;
                color: #33302D;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
                word-break: break-all;
                margin-bottom: 6px;
                .icon_img  {
                    margin-left: 2px;
                    width: 16px;
                    height: 16px;
                }
            }
            .link_desc{
                white-space:normal;
                font-size: 12px;
                font-family: STHeitiSC-Light, STHeitiSC;
                font-weight: 300;
                color: #969696;
                line-height: 14px;
                text-overflow: -o-ellipsis-lastline;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                line-clamp: 2;
                -webkit-box-orient: vertical;
            }
            
        }
         .image{
                width: 60px;
                height: 60px;
                border-radius: 2px;
            }
            .icon_radar{
                position: relative;
                &::after{
                content: '';
                width: 15px;
                height: 15px;
                background: url('@/assets/image/material/radar_red.png') no-repeat center;
                background-size: cover;
                position: absolute;
                top: 3px;
                right:3px;
                }
            }
    }
}
</style>
